using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public static class ConfigTask
{
    public static Dictionary<int, ConfigTaskElement> id2Element;

    public static ConfigTaskElement GetElement(int taskId)
    {
        ConfigTaskElement item;
        if (!id2Element.TryGetValue(taskId, out item)) {
            Debug.LogError("Can not find taskId:" + taskId);
         }
        return item;
    }

    static ConfigTask()
    {
        id2Element = new Dictionary<int, ConfigTaskElement>();
        var list = new List<ConfigTaskElement>() {
         new ConfigTaskElement() { Id = 1, Key = ItemDef.TypeIdWater, Value = 1, SpawnPosList = new List<Vector2>(){new Vector2(12, 6)}, Type = TaskType.Item, X = 16, Y = 4, Des = "我受伤了，无法行走，很口渴，能帮我找点水喝吗？", DesFinish = "喝完水后，我有力气帮你打开这扇门" },
         new ConfigTaskElement() { Id = 2, Key = ItemDef.TypeIdBrick, Value = 2, SpawnPosList = new List<Vector2>(){new Vector2(23, 16)}, Type = TaskType.Item, X = 26, Y = 16, Des = "我的房子被洪水冲走了，你能帮我找点石头来建房子吗？", DesFinish = "完成任务后，我帮你打开这扇门" }
        };
        foreach (var elem in list)
        {
            id2Element[elem.Id] = elem;
        }
    }
}
